


#include <pthread.h>
#include <unistd.h>
#include <android/native_window_jni.h>
//#include "NativeWindowsFFmpegPlayer.h"
#include "LogUtil.h"
#include "PlayerWrapper.h"

extern "C"{
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"
#include "libavutil/imgutils.h"
}

extern "C"
JNIEXPORT void JNICALL
Java_com_ts_tsavplayer_player_AVPlayer_n_1prepared(JNIEnv *env, jobject thiz, jstring source) {






}



extern "C"
JNIEXPORT void JNICALL
Java_com_ts_tsavplayer_player_AVPlayer_play(JNIEnv *env, jobject thiz, jlong player_handle) {
    PlayerWrapper *mPlayerWrapper=
            reinterpret_cast<PlayerWrapper *>(player_handle);
    mPlayerWrapper->Play();

}


extern "C"
JNIEXPORT jlong JNICALL
Java_com_ts_tsavplayer_player_AVPlayer_native_1Init1(JNIEnv *env, jobject obj, jstring jurl, int playerType, jint renderType, jobject surface) {
    const char* url = env->GetStringUTFChars(jurl, nullptr);
    PlayerWrapper *mPlayerWrapper=new PlayerWrapper();
    mPlayerWrapper->Init(env, obj, const_cast<char *>(url), playerType, renderType, surface);
    env->ReleaseStringUTFChars(jurl, url);
    return reinterpret_cast<jlong>(mPlayerWrapper);

}